package xpn.platform.modules.persistence;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;
import xpn.platform.modules.sys.user.SysUser;
import xpn.platform.modules.sys.user.SysUserService;
import java.util.Optional;
/**
 * Spring审计功能实现：提供当前审计者
 * 
 * @author bobatkm Oct 28, 2017
 *
 */
@Component
public class AuditorProvider implements AuditorAware<SysUser> {

	@Autowired
	SysUserService userService;


	@Override
	public Optional<SysUser> getCurrentAuditor() {
		return Optional.of(userService.getSessionUser());
	}

}
